package game.Config;

import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.geom.Circle;
import org.newdawn.slick.geom.Vector2f;

import Weapons.Weapon;

public class TowerConfiguration {
	String name;
	Image image;
	Weapon weapon;
	int cost;
	float sightRadius;
	private int[] baseCostUpgrades;
	private int[] costScale;
	private int[] statsScale;
	public TowerConfiguration(Image image, Weapon weapon, int cost, float sightRadius, String name,int[] baseCostUpgrades, int[] costScale, int[] statsScale){
		this.image = image;
		this.weapon = weapon;
		this.cost = cost;
		this.sightRadius = sightRadius;
		this.name = name;
		this.costScale = costScale;
		this.baseCostUpgrades = baseCostUpgrades;
		this.statsScale = statsScale;;
	}
	public int[] getBaseCostUpgrades(){
		return baseCostUpgrades.clone();
	}
	public int[] getCostScale(){
		return costScale.clone();
	}
	public int[] getStatsScale(){
		return statsScale.clone();
	}
	public float getSightRadius(){
		return this.sightRadius;
	}
	public Image getImage(){
		return this.image.copy();
	}
	public Weapon getWeapon(){
		return this.weapon.copy();
	}
	public int getCost(){
		return this.cost;
	}
	public String getName(){
		return this.name;
	}
	public TowerConfiguration copy(){
		return new TowerConfiguration(this.image.copy(),this.weapon.copy(),cost,sightRadius,name,
				this.baseCostUpgrades.clone(),this.costScale.clone(),this.statsScale.clone());
	}
	public void printInfo(Graphics graphic, Vector2f position) {
		graphic.setColor(Config.TOWER_INFO_COLOR);
		graphic.drawString(this.name, position.x, position.y+Config.TOWER_INFO_STARTOFFSET + Config.TOWER_INFO_OFFSET);
		graphic.drawString("Cost: " + this.cost, position.x, position.y+Config.TOWER_INFO_STARTOFFSET +Config.TOWER_INFO_OFFSET*2);
		graphic.drawString("Damage: " +this.weapon.getDamage(), position.x, position.y + Config.TOWER_INFO_STARTOFFSET + Config.TOWER_INFO_OFFSET*3);
		graphic.drawString("Rate of fire: "+this.weapon.getFireRate(), position.x, position.y + Config.TOWER_INFO_STARTOFFSET + Config.TOWER_INFO_OFFSET*4);
		image.draw(Storage.getPosition().x, Storage.getPosition().y + Config.HUD_HEIGHT);
		Circle circle = new Circle(Storage.getPosition().x + image.getWidth()/2,Storage.getPosition().y + image.getHeight()/2 + Config.HUD_HEIGHT,this.sightRadius);
		graphic.setColor(Config.SIGHT_RADIUS_COLOR);
		
		graphic.draw(circle);
		graphic.setColor(Config.STANDARD_COLOR);
		
		
	}
	
}
